<%-- 
    Document   : CartOnline
    Created on : May 12, 2014, 11:51:22 PM
    Author     : Tuan Long
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>


<html>
    <head>
        <title>Giza's Template</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Bootstrap core CSS -->
        <link href="css/bootstrap.min.css" rel="stylesheet">        
        <link href="css/dashboard.css" rel="stylesheet">
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>        
        <script src="js/bootstrap.min.js"></script>
        <script src="js/MyScript.js"></script>

    </head>
    <body>
        <!---- default | inverse: background , fixed | static - top- HEADER--->
        <div class="navbar navbar-default navbar-fixed-top" role="navigation">
            <!----Container---->
            <div class="container">
                <!--nav-header -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#">Giza's Assignment</a>
                </div>
                <!--nav-header end-->
                <!--nav-collapse -->
                <div class="navbar-collapse collapse">
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="index.jsp">Home</a></li>

                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Social Center <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li><a href="#">Facebook</a></li>
                                <li><a href="#">Twitter</a></li>
                                <li><a href="#">Google+</a></li>
                                <li><a href="#">Instagram</a></li>
                                <li class="divider"></li>
                                <li class="dropdown-header">Nav header</li>
                                <li><a href="#">Something else</a></li>
                            </ul>
                        </li>
                        <!--                        <li><a href="#about">About us</a></li>
                                                <li><a href="#contact">Contact us</a></li>-->
                        <li style="padding-top: 8px;">
                            <input type="text" placeholder="Search.." class="form-control" />
                        </li>
                    </ul>

                    <ul class="nav navbar-nav navbar-right">
                        <c:choose>
                            <c:when test="${sessionScope.online != null}">
                                <li style="padding-top: 13px;">Welcome, ${sessionScope.online.fullname}</li>
                                </c:when>
                                <c:when test="${sessionScope.online == null}">
                                <li class="dropdown" >
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Login<b class="caret"></b></a>
                                    <ul class="dropdown-menu" style="padding-left: 3px; padding-right: 3px;">                                        
                                        <form class="form-signin" role="form" action="Login.me" method="post">                                    
                                            <input type="text" class="form-control" placeholder="Username" name="username" required autofocus>
                                            <input type="password" class="form-control" placeholder="Password" name="password" required>                                    
                                            <button class="btn btn-primary btn-block" type="submit">Sign in</button>
                                        </form>
                                    </ul>
                                </li>
                                <li><a href="#">Register</a></li>
                                </c:when>
                            </c:choose>

                    </ul>
                </div>
                <!--nav-collapse end -->

            </div>
            <!----Container end---->
        </div>
        <!---HEADER END-->

        <!---Container---->
        <div class="container-fluid">
            <div class="row">
                <!---SIDEBAR--->
                <div class="col-sm-3 col-md-2 sidebar">
                    <ul class="nav nav-sidebar">
                        <li ><a href="AllProducts.me">All Products</a></li>
                        <li class="active"><a href="CartOnline.me">Your Cart</a></li>                        
                    </ul>
                </div>
                <!---SIDEBAR END--->
                <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
                    <h2 class="sub-header">Your Cart                        
                    </h2>
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                                <tr>
                                    <!--                                    <th>#</th>-->
                                    <th>Product ID</th>
                                    <th>Name</th>
                                    <th>Price($)</th>                                    
                                    <th>Amount</th>
                                    <th>Total Money($)</th>
                                </tr>
                            </thead>
                            <tbody>
                                <c:forEach var="p" items="${sessionScope.sessionOnlineCart}" varStatus="i">
                                    <tr>
                                        <td>${p.id}</td>
                                        <td>${p.name}</td>
                                        <td>${p.price}</td>
                                        <td><input type="number" value="${p.amount>0?p.amount:1}" style="width: 40px;"></td>
                                        <td>${p.price*p.amount}</td>
                                    </tr>
                                </c:forEach>                                
                            </tbody>
                        </table>
                    </div>
                    <div style="text-align: right;">
                        <a href="AllProducts.me" style="float: left;"><button type="button" class="btn btn-info">Buy More..</button></a>
                        <a href="#"><button type="button" class="btn btn-warning">Update Cart</button></a>
                        <a href="#"><button type="button" class="btn btn-warning">Finished</button></a>                        
                    </div>
                </div>
            </div>       

        </div>
        <!---Container END---->
        <!-- FOOTER -->
        <div class="container">
            <footer style="text-align: center;">
                <p class="pull-right scrollTop"><a href="#">Back to top</a></p>
                <p>&copy; 2014 Developed & Design By Giza &middot; <a href="https://www.facebook.com/">Facebook</a> &middot;</p>
            </footer>
        </div>
        <!-- FOOTER END -->

    </body>
</html>
